package com.example.lambda;

import com.example.dao.TestFather;

import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;

public class ArrayLambda {
    public static void main(String[] args) {
        String [] arrays = {"123","456","789"};
        List<String> list = Arrays.asList(arrays);

        for(String array: list){
            System.out.println(array);
        }

        /*list.forEach(String array : list){

        };*/

        list.forEach((array)-> System.out.println(array));

        list.forEach(System.out::println);

        TestFather<String,String> testFather = ArrayLambda::println;
        testFather.convert("测试冒号使用方法");

        TestFather<String,String> testFather2 = new ArrayLambda()::endWith;
        testFather2.convert("测试冒号使用方法");

        Consumer<String> consumer = ArrayLambda::noReturn;
        consumer.accept("测试冒号使用方法");

    }

    public static String println(String msg){
        System.out.println(msg);
        return msg;
    }

    String endWith(String msg){
        System.out.println(msg);
        return msg;
    }

    public static void noReturn(String msg){
        System.out.println(msg);
    }
}
